package StreamDemo;

import java.util.stream.Stream;

/**
 * @Author: ylc
 * @Description: Stream<T> skip(long n);
 *      用于跳过元素
 *      如果流的当前长度大于n，则跳过前n个；否则将会得到一个长度为0的空流。
 * @Date Created in 2022-05-05 20:28
 */
public class Demo7_skip {
    public static void main(String[] args) {
        String[] arr = {"叶凡", "张三", "赵云", "张飞"};
        Stream<String> stream = Stream.of(arr);
        //使用skip方法跳过前3个元素
        Stream<String> stream2 = stream.skip(3);
        //遍历stream2流
        stream2.forEach(name-> System.out.println(name));
    }
}
